#!/bin/bash

JLINKEXE=JLinkExe
DEVICE=EFR32BG1PXXXF256
LOADPORT=swd
SPEED=4000
JLINK_OPTIONS="-device EFR32BG1PXXXF256 -if swd -speed 4000"
BINPATH=$1
FLASH_START_ADDRESS=0x0

echo "r">flash.jlink
echo "loadbin $BINPATH $FLASH_START_ADDRESS">>flash.jlink
echo "r">>flash.jlink
echo "g">>flash.jlink
echo "q">>flash.jlink


$JLINKEXE -device $DEVICE -if $LOADPORT -speed $SPEED flash.jlink

rm flash.jlink

